package demo;

import application.NQueens;

import java.util.LinkedList;

public class DemoNQueens {
    public static void test(int n, NQueens nQueens) {
        nQueens.setN(n);
        LinkedList<Character[][]> result = nQueens.solve();
        System.out.println(String.format("========= %d Queens Problem, 共有 %d 种解 =========", n, result.size()));
        for (int i = 1; i <= result.size(); ++i) {
            Character[][] board = result.get(i-1);
            System.out.println(String.format("===> 第 %d 个解:", i));
            NQueens.printBoard(board);
        }
    }

    public static void main(String[] args) {
        NQueens nQueens = new NQueens();
        for (int i = 4; i <= 8; ++i) {
            test(i, nQueens);
        }
    }
}
